<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文</title>
<link th:href="@{/css/style.css}" rel="stylesheet" type="text/css" />
<script type="text/javascript" th:src="@{/js/jquery.js}"></script>
<script type="text/javascript">
function tipOpen(content) {
	$(".tipright p").text(content);
	$("#tip").fadeIn(200);
}
function tipClose() {
	$("#tip").fadeOut(200);
}
</script>
</head>

<body>
<div class="place"> <span>位置：</span>
  <ul class="placeul">
    <li>仓库管理</li>
    <li>仓库浏览</li>
    <li>基本内容</li>
  </ul>
</div>
<div class="rightinfo">

  <form action="/erp1/rep/ware/allWareBrowse" method="post" id="wareformb">

    <ul class="tools">
      <li>仓库名称:
        <input type="text" name="cName" th:value="${warehouseb.cName}"/>
        <input type="hidden" name="pageno" value="1" id="pageno"/>
      </li>
      <li> 所属区域：
        <select name="provinceId" onchange="getCity(this.value)">
          <option value="0">请选择省份</option>
          <option th:each="p : ${session.provinces}" th:value="${p.id}" th:text="${p.pName}"
                  th:selected="${p.id==warehouseb.provinceId}?true:false">请选择省份
          </option>
        </select>
        <select name="cityId">
          <option th:text="${warehouseb.city==null?'请选择城市':warehouseb.city.cName}"
                  th:value="${warehouseb==null?'0':warehouseb.cityId}"></option>
        </select>
      </li>
      <li class="subBut" onclick="goPage(1)"><img th:src="@{/images/t06.png}" />查询</li>
    </ul>
    <table class="tablelist">
      <thead>
        <tr>
          <th>序号</th>
          <th>仓库名称</th>
          <th>负责人</th>
          <th>联系电话</th>
          <th>所属区域</th>
          <th>状态</th>
          <th>创建时间</th>
          <th>创建人</th>
          <th>操作</th>
        </tr>
      </thead>
      <tbody>
        <tr th:each="w,var : ${replistb.list}">
          <td th:text="${(replistb.pageNum-1)*replistb.pageSize+var.count}"></td>
          <td th:text="${w.cName}"></td>
          <td th:text="${w.user.uname}"></td>
          <td th:text="${w.phone}"></td>
          <td th:text="${w.province.pName+''+w.city.cName}"></td>
          <td th:text="${w.state.equals('1')?'可用':'不可用'}"></td>
          <td th:text="${#dates.format(w.creationTime,'yyyy/MM/dd')}"></td>
          <td th:text="${w.creatUser.uname}"></td>
          <td>
            <a th:href="'/erp1/rep/ware/detail/'+${w.id}" class="tablelink">查看详情</a>
          </td>
        </tr>
      </tbody>
    </table>
    <div class="pagin">
      <div class="message">共<i class="blue" th:text="${replistb.total}"></i>条记录，当前显示第&nbsp;<i class="blue" th:text="${replistb.pageNum+'&nbsp;'}">2</i>页
      </div>
      <ul class="paginList">
        <li class="paginItem">
          <a href="javascript:void(0);" th:onclick="goPage([[${replistb.isFirstPage?1:replistb.pageNum-1}]])">
            <span th:class="${replistb.isFirstPage?'pagepre':'pagenxt roate'}"></span>
          </a>
        </li>
        <li th:class="${page==replistb.pageNum?'paginItem current':'paginItem'}"
            th:each="page : ${replistb.navigatepageNums}">
          <a href="javascript:;" th:text="${page}" th:onclick="goPage([[${page}]])">1</a>
        </li>
        <li class="paginItem">
          <a href="javascript:void(0);"
             th:onclick="goPage([[${replistb.isLastPage?replistb.pages:replistb.pageNum+1}]])">
            <span th:class="${replistb.isLastPage?'pagepre roate':'pagenxt'}"></span>
          </a>
        </li>
      </ul>
    </div>
  </form>
  <!-- 提示框 -->
  <div id="tip" class="tip">
    <div class="tiptop"><span>提示信息</span><a onclick="tipClose()"></a></div>
    <div class="tipinfo"> <span><img src="../../images/ticon.png" /></span>
      <div class="tipright">
        <p></p>
        <cite>如果是请点击确定按钮 ，否则请点取消。</cite> </div>
    </div>
    <div class="tipbtn">
      <input name="" type="button"  class="sure" value="确定" onclick="tipClose()" />
      &nbsp;
      <input name="" type="button"  class="cancel" value="取消" onclick="tipClose()" />
    </div>
  </div>
</div>
<script th:inline="javascript">
	$('.tablelist tbody tr:odd').addClass('odd');

	$(function () {
      var num=$("select[name=provinceId]").val();
      getCity(num);
    });

    function getCity(num) {
      $.get("/erp1/ajaxCity", {"pid": num}, function (data) {
        $("select[name=cityId]").html("");
        var options = "<option value=''>请选择城市</option>"
        var w=[[${warehouseb.cityId}]]
        $.each(data, function (i, e) {
          if(w==e.id){
            options += "<option value='" + e.id + "' selected='selected'>" + e.cname + "</option>";
          }else {
            options+="<option value='"+e.id+"'>"+e.cname+"</option>";
          }
        })
        $("select[name=cityId]").append(options);
      }, "json");
    }

    function goPage(num) {
      $("#pageno").val(num);
      $("#wareformb").submit();
    }
</script>
</body>
</html>
